package com.c.util;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public class CollectionTest {

	public static void main(String[] args) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("1", "a");
		map.put("2", "b");
		map.put("3", "c");
		// 遍历1
		for (String arg : map.keySet()) {
			System.out.println("key:" + arg + "  value:" + map.get(arg));
		}

		for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext();) {
			Entry<String, String> entry = (Entry<String, String>) iterator.next();
			System.out.println("key= " + entry.getKey() + " and value= " + entry.getValue());

		}

		for (Entry<String, String> entry : map.entrySet()) {
			System.out.println("key= " + entry.getKey() + " and value= " + entry.getValue());

		}

		Set<String> set = new HashSet<String>();
		set.add("1");
		set.add("2");
		set.add("3");

	}

}
